package nl.rainbowsheep.reisorg.rest.service.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.stereotype.Service;

/**
 *
 * @author ieme
 */
//Service
@Service("mailService")
public class MailingService {

    @Autowired
    private MailSender mailSender;

  
    /**
     * This method will compose and send the message 
     *
     * @param to recipients mail adres
     * @param subject Subject of the e-mail
     * @param body Body of the e-mail
     */
    public void sendMail(String to, String subject, String body) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setTo(to);
        message.setSubject(subject);
        message.setText(body);
        mailSender.send(message);
    }
}

